package org.sbbs.examples.example1.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import org.sbbs.base.model.UUIDBaseObject;

@Entity
@Table(name = "t_demo_entity")
public class DemoEntity extends UUIDBaseObject {

	/**
	 *
	 */
	private static final long serialVersionUID = 5295152954297131636L;

	/**
	 */
	@Column(name = "intField", nullable = false)
	private int intField;

	private String stringField;

	public int getIntField() {
		return this.intField;
	}

	public void setIntField(int intField) {
		this.intField = intField;
	}

	@Column(name = "stringField", length = 50, nullable = false)
	public String getStringField() {
		return this.stringField;
	}

	public void setStringField(String stringField) {
		this.stringField = stringField;
	}

	@Override
	public String toString() {
		return "DemoEntity [intField=" + intField + ", stringField=" + stringField + ", id=" + id + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + intField;
		result = prime * result + ((stringField == null) ? 0 : stringField.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		DemoEntity other = (DemoEntity) obj;
		if (intField != other.intField)
			return false;
		if (stringField == null) {
			if (other.stringField != null)
				return false;
		} else if (!stringField.equals(other.stringField))
			return false;
		return true;
	}

}
